perm filename PLTOTF.CH[TEX,DEK]1 blob
sn#664864 filedate 1982-06-28 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00004 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 @ This program is written entirely in standard \PASCAL, except that
C00004 00003 @ On some systems you may have to do something special to write a
C00005 00004 @ Here is a procedure that does the right thing when we are done
C00015 ENDMK
C⊗;
@ This program is written entirely in standard \PASCAL, except that
it writes on the terminal instead of the |output| file, and it has to do
some slightly system-dependent character code conversion on input.
Furthermore, lower case letters are used in error messages; they could be
converted to upper case if necessary. The input is read from |pl_file|;
error messages and other remarks are written on the terminal.
@↑system dependencies@>
The term |print| is used instead of |write| when this program writes on
the |output| file, so that all such output can be easily deflected.
@d print(#)==write(tty,#)
@d print_ln(#)==write_ln(tty,#)
@p @t\4@>@{$D-,W+@} {no debugging overhead}
program PLtoTF(@!pl_file,@!tfm_file);
const @<Constants in the outer block@>@/
type @<Types in the outer block@>@/
var@?@<Globals in the outer block@>@/
procedure initialize; {this procedure gets things started properly}
var@?@<Local variables for initialization@>@/
begin print_ln(banner);@/
@<Set initial values@>@/
end;
@↑changes that were made for {\mc WAITS}@>
@z
@ On some systems you may have to do something special to write a
packed file of bytes. For example, the following code doesn't work without
the \.{/B} switch at {\mc WAITS}, although it probably should?
@↑system dependencies@>
@<Set init...@>=
rewrite(tfm_file,'','/B:8');
@↑changes that were made for {\mc WAITS}@>
@z
@ Here is a procedure that does the right thing when we are done
reading the present contents of the buffer. It keeps |buffer[buf_size]|
empty, in order to avoid range errors on certain \PASCAL\ compilers.
An infinite sequence of right parentheses is placed at the end of the
file, so that the program is sure to get out of whatever level of nesting
it is in.
The normal \.{PLtoTF} code has been modified here so that tab marks
in the buffer are replaced by blank spaces.
@↑system dependencies@>
@p procedure fill_buffer;
begin left_ln←right_ln; limit←0; loc←0;
if eof(pl_file) then
begin limit←1; buffer[1]←')'; incr(line); input_has_ended←true;
end
else begin if left_ln then
begin if line>0 then read_ln(pl_file);
incr(line);
end;
while (limit<buf_size-1)∧(not eoln(pl_file)) do
begin incr(limit); read(pl_file,buffer[limit]);
if buffer[limit]=chr(@'11) then buffer[limit]←' ';
{tab mark is changed to space}
end;
buffer[limit+1]←' '; right_ln←eoln(pl_file);
if left_ln then @<Set |loc| to the number of leading blanks in
the buffer, and check the indentation@>;
end;
end;
@↑changes that were made for {\mc WAITS}@>
@z